#include <iostream>
#include <unordered_map>
#include <vector>

std::vector<int> solve_two(int target,std::vector<int>&v,int exclusive)
{
    //
    int n = v.size();
    std::vector<int>res;

    if (!n)     return res;
    
    //
    std::unordered_map<int,int>mp;
    for (auto i : v)
    {
        if (mp.find(mp[i]) != mp.end()&&i+mp[i]== target)
        {
            res.push_back(mp[i]);
            res.push_back(i);
            return res;
        }
        else 
        {
            mp[i] = i;
        }
    }
}

std::vector<std::vector<int>> solve(std::vector<int>&v)
{
    // 首先对于数组中的每一个数字
    // 将其的相反数作为目标值来找到相加与其相等的两个数字
    // 但是注意要标注这个数字对应的下标
    int n = v.size();
    std::vector<std::vector<int>>res;

    // 如果长度为零直接返回
    if (!n) return res;

    for (int i = 0;i < n;i++)
    {
        std::vector<int>res1 = solve_two(-v[i],v,i);
        if (!res1.empty())
        {
            res1.push_back(v[i]);
            res.push_back(res1);
        }
    }

    return res;
}

int main()
{
    std::vector<int>v;
    v.push_back(-10);
    v.push_back(5);
    v.push_back(5);
    v.push_back(20);
    v.push_back(-10);
    std::vector<std::vector<int>>res = solve(v);
    
    for (auto i:res[0])
    {
        std::cout<<i<<std::endl;
    }
    return 0;
}